< previous page page_268 next page >

Page 268
e10a6a0a59f035e870d90cca05b85fce.gif
        j = Int((num_chunks - i + 1) * Rnd + i)

        ' Swap that entry with the one in position i.
        If i <> j Then
            tmp = chunk_row(i)
            chunk_row(i) = chunk_row(j)
            chunk_row(j) = tmp
            tmp = chunk_col(i)
            chunk_col(i)  = chunk_col(j)
            chunk_col(j) = tmp
        End If
    Next i

    ' Display the tiles.
    DisplayTiles pic_new, pic_old, ms_per_frame, _
        divisions_per_side, chunk_row, chunk_col

    Wiping = False
End Sub

' Display the tiles in the indicated order.
Private Sub DisplayTiles( _
    ByVal pic_new As PictureBox, _
    ByVal pic_old As PictureBox, _
    ByVal ms_per_frame As Long, _
    ByVal divisions_per_side As Integer, _
    chunk_row() As Integer, _
    chunk_col() As Integer)
Dim num_chunks As Integer
Dim chunk As Integer
Dim next_time As Long
Dim wid As Single
Dim hgt As Single

    wid = pic_old.ScaleWidth / divisions_per_side
    hgt = pic_old.ScaleHeight / divisions_per_side
    num_chunks = divisions_per_side * divisions_per_side

    ' Start displaying the tiles.
    next_time = GetTickCount()
    For chunk = 1 To num_chunks
        ' Copy the tile area.
        BitBlt pic_old.hDC, _
            wid * chunk_col(chunk), _
            hgt * chunk_row(chunk), _
            wid, hgt, _
            pic_new.hDC, _
            wid * chunk_col(chunk), _
            hgt * chunk_row(chunk), _
            vbSrcCopy
        pic_old.Refresh

 
< previous page page_268 next page >